Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
m2e-validator
Advanced tools
This package converts Mongoose schema into a validation chain for Express. Currently, it supports most default schema types as well as a few custom ones. For instance, schema types named Email or Phone match validator's implementation. See the full list of supported properties below.
This module works through a custom Mongoose plugin that appends two static methods, getSchemaPaths
and getChildPaths
. Both work recursively and support child and discriminator schemas. To access a discriminator, though, the request object must contain a reference to its key. See the examples below for more detail.
// coming soon
All schema types support required and systemOnly properties. The latter omits the field from validation altogether.
Name | Options | Notes |
---|---|---|
String | minLength, maxLength, enum | Auto escapes and trims |
Number | min, max | |
ObjectId | ||
SchemaArray | ||
Date | Auto converts to ISO string | |
Boolean | Auto converts any non-falsy value to true | |
URL | -- | Auto normalizes |
-- | Auto normalizes | |
Phone | -- |
FAQs
Convert mongoose schema into an express-validator chain
The npm package m2e-validator receives a total of 2 weekly downloads. As such, m2e-validator popularity was classified as not popular.
We found that m2e-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.